package com.cattsoft.android.notificationAndToast;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class Main extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (null != getIntent()) {
			Bundle bundle = getIntent().getExtras();
			if (null != bundle) {
				if ("Y".equals(bundle.getString("back"))) {
					Toast toast = new Toast(this);
					//toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
					TextView view = new TextView(this);
					view.setText(bundle.getString("msg"));
					toast.setView(view);
					toast.setDuration(100);
					toast.show();
				}
			}
		}

		setContentView(R.layout.main);
		((Button) findViewById(R.id.noteBtn))
				.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						startActivity(new Intent(Main.this,
								NotificationActivity.class));
					}
				});
	}
}